﻿using System;
using System.Collections.Generic;

namespace _1a{
    class Program{
    private static int getNum()
    {
        Console.Write("请输入整数：");
        int num;
        try
        {
            num = Convert.ToInt32(Console.ReadLine());
        }
        catch (Exception e)
        {
            Console.WriteLine("输入格式不对。");
            num = getNum();
        }
        if (num <= 1)
        {
            Console.WriteLine("输入整数必须大于1。");
            num = getNum();
        }
        return num;
    }
    private static List<int> Calculate(int num)
    {
        List<int> result = new List<int>();
        for (int i = 2; i * i <= num; i++)
        {
            while (num % i == 0)
            {
                result.Add(i);
                num = num / i;
            }
        }
        if (num != 1)
        {
            result.Add(num);
        }
        return result;
    }
    static void Main(string[] args)
    {
        int num = getNum();
        List<int> result = Calculate(num);
        Console.Write("素因子为:");
        foreach (int n in result)
        {
            Console.Write(n + " ");
        }
    }
}
}
